package cn.qiao.demo.absFactory.service.factory;

import cn.qiao.demo.absFactory.service.Fruit;
import cn.qiao.demo.absFactory.service.impl.Apple;
import cn.qiao.demo.absFactory.service.impl.Orange;

/**
 * desc:
 *
 * @author qiao
 * @date 2022年04月18日 17:41
 */
public class FruitFactory {

    public static Fruit createFruit(String name){
        Fruit fruit;
        if ("Apple".equals(name)){
            fruit = new Apple();
        } else if ("Orange".equals(name)){
            fruit = new Orange();
        }else {
            fruit = null;
        }
        return fruit;
    }

}
